package com.atguigu.juc.completableFuture;

import java.util.concurrent.CompletableFuture;

/**
 * @author yfstart
 * @create 2022-06-23 9:57
 */
public class CompletableFutureAPISequence {
  public static void main(String[] args) {
    System.out.println(CompletableFuture.supplyAsync(() -> "resultA").thenRun(() -> {}).join());
    System.out.println(
        CompletableFuture.supplyAsync(() -> "resultA")
            // resultA -> System.out.println(resultA)
            .thenAccept(System.out::println)
            .join());
    System.out.println(
        CompletableFuture.supplyAsync(() -> "resultA")
            .thenApply(resultA -> resultA + " resultB")
            .join());
  }
}
